package com.it.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.it.domain.Customer;
import com.it.mapper.CustomerMapper;
import com.it.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public List<Customer> getAllCustomers() {
        return customerMapper.selectAll();
    }

    @Override
    public Customer getCustomerById(Integer id) {
        return customerMapper.selectById(id);
    }

    @Override
    public boolean createCustomer(Customer customer) {
        return customerMapper.insert(customer) > 0;
    }

    @Override
    public boolean updateCustomer(Customer customer) {
        return customerMapper.update(customer) > 0;
    }

    @Override
    public boolean deleteCustomer(Integer id) {
        return customerMapper.delete(id) > 0;
    }
}
